/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models.beans;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
 *
 * @author Hoang Dong Tien
 * @validate Dang The Cuong
 */
public class FAQ extends org.apache.struts.action.ActionForm {

    private int FAQId;
    private String question;
    private String answer;

    public int getFAQId() {
        return FAQId;
    }

    public void setFAQId(int FAQId) {
        this.FAQId = FAQId;
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public FAQ() {
        super();
        this.FAQId = 0;
        this.question = "";
        this.answer = "";
    }

     @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if(question == null || question.equals(""))
        {
            errors.add("questionnull",new ActionMessage("faqs.question.required"));
        }
        if(answer == null || answer.equals(""))
        {
            errors.add("answernull",new ActionMessage("faqs.answer.required"));
        }
        return errors;
    }
}
